<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <title>医院列表</title>
    <!-- Path to Framework7 Library CSS-->
    <link rel="stylesheet" href="../css/framework7.ios.min.css">
    <link rel="stylesheet" href="../css/framework7.ios.colors.min.css">
    <!-- Path to your custom app styles-->
    <link rel="stylesheet" href="../css/my-app.css">
    <link rel="stylesheet" href="../css/ekang.css"/>
    <style type="text/css">
        li {
            width: 100%;
            height: 40px;
            border-top: 1px solid #e6e6e6;
            background-color: white;
            list-style-type: none;
        }

        li span {
            line-height: 40px;
            margin-left:10px;
            color: #1b1b1b;
            font-size: 14px;
        }
    </style>
</head>
<body>

<div class="views tabs toolbar-through">
    <!--导航条-->
    <!-- Second view (for second wrap)-->
    <div id="view" class="view view-main tab active">
        <!-- We can make with view with navigation, let's add Top Navbar-->
        <div class="navbar">
            <div class="navbar-inner" style="background-color: #38a16d">
                <div class="left" id="back">
                    <a href="#" class="back link">
                        <i class="icon icon-back color-white" style="color: white"></i>
                        <span style="color: white">返回</span>
                    </a>
                </div>
                <div class="center sliding" style="color: white">医院列表</div>
            </div>
        </div>

        <div class="pages navbar-through">
            <div data-page="index-2" class="page page-on-center">
                <div class="page-content">
                    <div>
                        <ui id="hospitalList">
                        </ui>
                    </div>

                </div>
            </div>
        </div>
    </div>

</div>
<script type="text/javascript" src="../js/framework7.min.js"></script>
<script type="text/javascript" src="../js/my-app.js"></script>
<script src="../js/jquery-1.10.2.js"></script>
<script src="../js/ekang.js"></script>
<script src="../js/jquery.cookie.js"></script>
<script>
    $(function () {
        var type = getQueryString("type");
        var app = {
            // 获取医院列表
            getHospital: function(){
                $.ajax({
                    type: 'GET',
                    url: textUrl +'/hospital/hospitalList',
                    data: {
                        page_size: '600',
                        page_index: 1,
                        sid: '',
                    },
                    dataType: 'jsonp',
                    jsonp: 'callback',
                    success: function (result) {
                        if (result.ret == 0) {
                            var item = '';
                            $.each(result.data, function (i, o) {
                                item += '<li data-id="' + o.id + '" data-name="'+ o.name+'"><span>' + o.name + '</span></li>';
                            });
                            $('#hospitalList').html(item);

                            $('#hospitalList li').on('click', function () {
                                hospital_ID = $(this).data('id');
                                hospital_name = $(this).data('name');
                                if(type == 300){
                                    $.cookie('accom_hospital_name', hospital_name, { expires: 7,path: '/' });
                                    $.cookie('accom_hospital_id', hospital_ID, { expires: 7,path: '/' });
                                    history.back();
                                }else{
                                    location.href = "hospitalDetail.html?hospitalId="+hospital_ID;
                                }
                            });
                        }
                    }
                });
            },
        };

        app.getHospital();
        $('#back').on('click', function () {
            history.back();
        });
    });
</script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js" type="text/javascript"></script>
<script src="../js/weixin2.js"></script>
</body>
</html>